package StoreCredit;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class StoreCredit {

	/**
	 * @param args
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws FileNotFoundException {

		String file = "src/StoreCredit/A-large-practice.in";
		Scanner sc = new Scanner(new File(file));

		int numberOfsets, credit, numberOfitems;

		numberOfsets = sc.nextInt();

		boolean stop = false;
		for (int i = 1; i <= numberOfsets; i++) {
			stop = false;
			credit = sc.nextInt();
			numberOfitems = sc.nextInt();

			int[] items = new int[numberOfitems];
			for (int j = 0; j < items.length; j++) {
				items[j] = sc.nextInt();
			}

			for (int k = 0; k < items.length - 1; k++) {
				if (stop) {
					break;
				}
				for (int l = k + 1; l < items.length; l++) {
					if (items[k] + items[l] == credit) {
						System.out.println("Case #" + i + ": " + (k + 1) + " "
								+ (l + 1));
						stop = true;
						break;
					}
				}
			}
		}
		sc.close();

	}

}
